//
//  DateExt.swift
//  TimeRecord
//
//  Created by cgw on 2022/5/9.
//

import UIKit

extension Date {
    func toString(fmt: String = "yyyy-MM-dd") -> String?{
        let df = DateFormatter.init()
        df.dateFormat = fmt
        return df.string(for: self)
    }
    
    func toTimeString() -> String?{
        return self.toString(fmt: "yyyy-MM-dd HH:mm:ss")
    }
}
